package user;  
import java.sql.*;  
public class Register {
	private Take take;  
    private Connection con;  
    public Register()  
    {  
      String url="jdbc:mysql://localhost/"+"nytest"+"?user="+"root"+"&password="+"x5";  
    try  
    {  
      Class.forName("com.mysql.jdbc.Driver").newInstance();  
      con = DriverManager.getConnection(url);  
     }
    catch(Exception e)
    {  
      e.printStackTrace();  
    }  
    }  
    public void setUserBean(Take take)  
    {  
      this.take=take;  
    }  
    public void regist() throws Exception  
    {  
      String reg="insert into users(userid,password)  values(?,?)";  
    try  
    {  
      PreparedStatement pstmt=con.prepareStatement(reg);  
      pstmt.setString(1,take.getUserId());  
      pstmt.setString(2,take.getPassword());  
      pstmt.executeUpdate();  
    }  
    catch(Exception e)  
    {  
      e.printStackTrace();  
      throw e;  
    }  
    }  

}
